import request from '@/utils/request'

// 查询API Key池列表
export function listApiKeyPool(query) {
  return request({
    url: '/tzai/api/keypool/list',
    method: 'get',
    params: query
  })
}

// 查询API Key池详细
export function getApiKeyPool(keyId) {
  return request({
    url: '/tzai/api/keypool/' + keyId,
    method: 'get'
  })
}

// 新增API Key池
export function addApiKeyPool(data) {
  return request({
    url: '/tzai/api/keypool',
    method: 'post',
    data: data
  })
}

// 修改API Key池
export function updateApiKeyPool(data) {
  return request({
    url: '/tzai/api/keypool',
    method: 'put',
    data: data
  })
}

// 删除API Key池
export function delApiKeyPool(keyId) {
  return request({
    url: '/tzai/api/keypool/' + keyId,
    method: 'delete'
  })
}

// 导出API Key池
export function exportApiKeyPool(query) {
  return request({
    url: '/tzai/api/keypool/export',
    method: 'post',
    params: query
  })
}

// 恢复限流状态的Key
export function recoverRateLimitedKeys() {
  return request({
    url: '/tzai/api/keypool/recover',
    method: 'post'
  })
}

